const app = getApp();
Page({
  data: {
    pageName: '闯关报告',
    navH: app.globalData.navHeight,
    windowHeight: 0,
    imageUrl: "https://yxpmaterial.oss-cn-beijing.aliyuncs.com/",
    minutes: parseInt(app.globalData.taskTwoMinuts / 60),
    reportData: {},
    date: '', //学习日期
    isContinueDisabled: false, //继续闯关按钮是否可用
  },
  onLoad: function(options) {
    this.getData();
    wx.getSystemInfo({
      success: res => {
        this.data.windowHeight = res.windowHeight - this.data.navH,
          this.data.windowWidth = res.windowWidth
      },
      fail(err) {
        console.log(err);
      }
    })
    this.setData({
      windowHeight: this.data.windowHeight
    })
  },
  onReady: function() {


  },
  onShow: function() {
    var that = this;
    if (that.data.reportData.remain < 6) {
      that.setData({
        isContinueDisabled: true
      })
    }
  },


  onHide: function() {

  },
  onUnload: function() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function() {},
  getData: function() {

    this.setData({
      reportData: app.globalData.taskTwoUpresult,
      date: app.globalData.taskTwoUpresult.date,
    });

  },
  goWrong: function() {
    if (this.data.reportData.err == 0) {
      wx.showToast({
        title: '暂无错词哦',
        icon: 'none'
      })
      return;
    }
    wx.navigateTo({
      url: '../twoWrong/twoWrong',
    })
  },
  goPlay: function() {
    wx.redirectTo({
      url: '../takesTwo?date=' + this.data.date,
    })
  },

})